<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Soap_Client - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.soap.client.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.soap.client.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.soap.server.html">Zend_Soap_Server</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.soap.html">Zend_Soap</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.soap.wsdl.html">WSDL Accessor</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.soap.client" class="section"><div class="info"><h1 class="title">Zend_Soap_Client</h1></div>
    

    <p class="para">
        The <span class="classname">Zend_Soap_Client</span> class simplifies <acronym class="acronym">SOAP</acronym> client
        development for <acronym class="acronym">PHP</acronym> programmers.
    </p>

    <p class="para">
        It may be used in WSDL or non-WSDL mode.
    </p>

    <p class="para">
        Under the WSDL mode, the <span class="classname">Zend_Soap_Client</span> component uses a WSDL
        document to define transport layer options.
    </p>

    <p class="para">
        The WSDL description is usually provided by the web service the client will access. If the
        WSDL description is not made available, you may want to use
        <span class="classname">Zend_Soap_Client</span> in non-WSDL mode. Under this mode, all
        <acronym class="acronym">SOAP</acronym> protocol options have to be set explicitly on the
        <span class="classname">Zend_Soap_Client</span> class.
    </p>

    <div class="section" id="zend.soap.client.constructor"><div class="info"><h1 class="title">Zend_Soap_Client Constructor</h1></div>
        

        <p class="para">
            The <span class="classname">Zend_Soap_Client</span> constructor takes two parameters:

            <ul class="itemizedlist">
                <li class="listitem">
                    <p class="para">
                        <var class="varname">$wsdl</var> - the <acronym class="acronym">URI</acronym> of a WSDL file.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        <var class="varname">$options</var> - options to create <acronym class="acronym">SOAP</acronym>
                        client object.
                    </p>
                </li>
            </ul>

            Both of these parameters may be set later using  <span class="methodname">setWsdl($wsdl)</span>
            and  <span class="methodname">setOptions($options)</span> methods respectively.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Important!</b><br /></span>
            

            <p class="para">
                If you use <span class="classname">Zend_Soap_Client</span> component in non-WSDL mode, you
                <em class="emphasis">must</em> set the &#039;location&#039; and &#039;uri&#039; options.
            </p>
        </p></blockquote>

        <p class="para">
            The following options are recognized:

            <ul class="itemizedlist">
                <li class="listitem">
                    <p class="para">
                        &#039;soap_version&#039; (&#039;soapVersion&#039;) - soap version to use (SOAP_1_1 or
                        <acronym class="acronym">SOAP</acronym>_1_2).
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;classmap&#039; (&#039;classMap&#039;) - can be used to map some WSDL types to
                        <acronym class="acronym">PHP</acronym> classes.
                    </p>

                    <p class="para">
                        The option must be an array with WSDL types as keys and names of
                        <acronym class="acronym">PHP</acronym> classes as values.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;encoding&#039; - internal character encoding (UTF-8 is always used as an
                        external encoding).
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;wsdl&#039; which is equivalent to  <span class="methodname">setWsdl($wsdlValue)</span>
                        call.
                    </p>

                    <p class="para">
                        Changing this option may switch <span class="classname">Zend_Soap_Client</span>
                        object to or from WSDL mode.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;uri&#039; - target namespace for the <acronym class="acronym">SOAP</acronym> service (required
                        for non-WSDL-mode, doesn&#039;t work for WSDL mode).
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;location&#039; - the <acronym class="acronym">URL</acronym> to request (required for
                        non-WSDL-mode, doesn&#039;t work for WSDL mode).
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;style&#039; - request style (doesn&#039;t work for WSDL mode):
                        <b><tt>SOAP_RPC</tt></b> or <b><tt>SOAP_DOCUMENT</tt></b>.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;use&#039; - method to encode messages (doesn&#039;t work for WSDL mode):
                        <b><tt>SOAP_ENCODED</tt></b> or <b><tt>SOAP_LITERAL</tt></b>.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;login&#039; and &#039;password&#039; - login and password for an <acronym class="acronym">HTTP</acronym>
                        authentication.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;proxy_host&#039;, &#039;proxy_port&#039;, &#039;proxy_login&#039;, and &#039;proxy_password&#039; - an
                        <acronym class="acronym">HTTP</acronym> connection through a proxy server.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;local_cert&#039; and &#039;passphrase&#039; - <acronym class="acronym">HTTPS</acronym> client certificate
                        authentication options.
                    </p>
                </li>

                <li class="listitem">
                    <p class="para">
                        &#039;compression&#039; - compression options; it&#039;s a combination of
                        <b><tt>SOAP_COMPRESSION_ACCEPT</tt></b>,
                        <b><tt>SOAP_COMPRESSION_GZIP</tt></b> and
                        <b><tt>SOAP_COMPRESSION_DEFLATE</tt></b> options which may be used like
                        this:
                    </p>

                    <pre class="programlisting brush: php">
// Accept response compression
$client = new Zend_Soap_Client(&quot;some.wsdl&quot;,
  array(&#039;compression&#039; =&gt; SOAP_COMPRESSION_ACCEPT));
...

// Compress requests using gzip with compression level 5
$client = new Zend_Soap_Client(&quot;some.wsdl&quot;,
  array(&#039;compression&#039; =&gt; SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5));
...

// Compress requests using deflate compression
$client = new Zend_Soap_Client(&quot;some.wsdl&quot;,
  array(&#039;compression&#039; =&gt; SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE));
</pre>

                </li>
            </ul>
        </p>
    </div>

    <div class="section" id="zend.soap.client.calls"><div class="info"><h1 class="title">Performing SOAP Requests</h1></div>
        

        <p class="para">
            After we&#039;ve created a <span class="classname">Zend_Soap_Client</span> object we are ready to
            perform <acronym class="acronym">SOAP</acronym> requests.
        </p>

        <p class="para">
            Each web service method is mapped to the virtual <span class="classname">Zend_Soap_Client</span>
            object method which takes parameters with common <acronym class="acronym">PHP</acronym> types.
        </p>

        <p class="para">
            Use it like in the following example:
        </p>

        <pre class="programlisting brush: php">
//****************************************************************
//                Server code
//****************************************************************
// class MyClass {
//     /**
//      * This method takes ...
//      *
//      * @param integer $inputParam
//      * @return string
//      */
//     public function method1($inputParam) {
//         ...
//     }
//
//     /**
//      * This method takes ...
//      *
//      * @param integer $inputParam1
//      * @param string  $inputParam2
//      * @return float
//      */
//     public function method2($inputParam1, $inputParam2) {
//         ...
//     }
//
//     ...
// }
// ...
// $server = new Zend_Soap_Server(null, $options);
// $server-&gt;setClass(&#039;MyClass&#039;);
// ...
// $server-&gt;handle();
//
//****************************************************************
//                End of server code
//****************************************************************

$client = new Zend_Soap_Client(&quot;MyService.wsdl&quot;);
...

// $result1 is a string
$result1 = $client-&gt;method1(10);
...

// $result2 is a float
$result2 = $client-&gt;method2(22, &#039;some string&#039;);
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.soap.server.html">Zend_Soap_Server</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.soap.html">Zend_Soap</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.soap.wsdl.html">WSDL Accessor</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.soap.html">Zend_Soap</a></li>
  <li><a href="zend.soap.server.html">Zend_Soap_Server</a></li>
  <li class="active"><a href="zend.soap.client.html">Zend_Soap_Client</a></li>
  <li><a href="zend.soap.wsdl.html">WSDL Accessor</a></li>
  <li><a href="zend.soap.autodiscovery.html">AutoDiscovery</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>